<?php
class IndexController extends DefaultModuleController {

	public function actionIndex() {
		// 首页新闻
		$newsList = $this->ArticleModel->findAll("categoryId='45' AND storeId='".GODHOUSE_CATEGORY_NEWS."'  AND position='0' ", 1, 8);
		foreach ($newsList as &$v){
			$v['createdTime'] = date('Y-m-d', $v['createdTime']);
			$v['title'] = cutstr($v['title'], '26', '');
		}
		
		// 轮换图
		$pics = $links = $texts = '';	
		$indexFlash = $this->ArticleModel->findAll("position='1' ", 1, 3);
		$texts = $pics = $links = array();
		foreach($indexFlash as $flash) {
			$texts[] = $flash['title'];
			$pics[]  = $flash['picture'];
			$links[] = $flash['url'];
		}
		$this->view->assign('texts', $texts);
		$this->view->assign('pics', $pics);
		$this->view->assign('links', $links);
		
		// 技术文档
		$jishuList = $this->ArticleModel->findAll("categoryId='66' AND storeId='".GODHOUSE_CATEGORY_NEWS."' AND position='0' ", 1, 5);
		foreach ($jishuList as &$v){
			$v['title'] = cutstr($v['title'],'24', '');
		}

		
		// 热门礼品
		$giftsList = $this->GiftsModel->findAll('', 1, 4, "click DESC");
		foreach ($giftsList as &$v){
			$v['title'] = cutstr($v['title'],'22');
		}
		
		$this->view->assign('giftsList', $giftsList);
		$this->view->assign('newsList',$newsList);
		$this->view->assign('jishuList',$jishuList);
		$this->display('index');
	}
}
